import request from '@/utils/request'

//获取SPU列表
export const reqGetSpuList = (page,limit,category3Id)=>{
  return request({
    url:`/admin/product/${page}/${limit}`,
    param:[category3Id],
    method:'get'
  })
}
//获取Spu信息
export const reqSpu = (spuId)=>{
  return request({
    url:`/admin/product/getSpuById/${spuId}`,
    method:'GET'
  })
}
//获取品牌信息
export const reqTrademarkList = ()=>{
  return request({
    url:`/admin/product/baseTrademark/getTrademarkList`,
    method:'GET'
  })
}
//获取整个平台的销售属性
export const reqBaseSaleAttrList = ()=>{
  return request({
    url:`/admin/product/baseSaleAttrList`,
    method:'GET'
  })
}
//修改或添加SPU
export const reqUpdateOrAddSpu = (spuInfo)=>{
  if (spuInfo.id){
    //修改
    return request({
      url:'/admin/product/updateSpuInfo',
      method:'post',
      data:spuInfo
    })
  }else{
    //添加
    return request({
      url:'/admin/product/saveSpuInfo',
      method:'post',
      data:spuInfo
    })
  }
}
//删除SPU
export const reqDeleteSpu = (spuId)=>{
  return request({
    url:`/admin/product/deleteSpu/${spuId}`,
    method:'DELETE'
  })
}
//获取图片
export const reqSpuImageList = (spuId)=>{
  return request({
    url:`/admin/product/spuImageList/${spuId}`,
    method:'GET'
  })
}
//获取销售属性
export const reqSpuSaleAttrList = (spuId)=>{
  return request({
    url:`/admin/product/spuSaleAttrList/${spuId}`,
    method:'GET'
  })
}
//获取平台属性信息
export const reqAttrInfoList = (category1Id,category2Id,category3Id)=>{
  return request({
    url:`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method:'GET'
  })
}
//保存SKU信息
export const reqSaveSkuInfo = (data)=>{
  return request({
    url:'/admin/product/saveSkuInfo',
    method:'POST',
    data
  })
}
//查看sku实例列表
export const reqSkuList = (spuId)=>{
 return request({
   url:`/admin/product/findBySpuId/${spuId}`,
   method:'GET'
 })
}

